# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍  
# Name:         demo10
# Description:
# Author:       98745
# Date:         2019/3/3
#-------------------------------------------------------------------------------

class my:
    def __setattr__(self, name, a):
        if name=='value':
            if a>0:
               self.__dict__[name]=a
               print(name)
            else:
                print('{}属性值必须大于0'.format(name))
        else:
            self.__dict__[name]=a
            print(name)
c=my()
c.value=20
print('c.value=',c.value)
c.value=-23
print('c.value=',c.value)